#ifndef __KillCockroachs__Config__
#define __KillCockroachs__Config__

#define kMedium 1.0

#define kSmall 0.5

#define kLarger 2.0

#define kCountdown 3

//music
#define kMusicEnd "music/gameover.ogg"
#define kMusicHit44100 "music/squash.ogg"
#define kMusicHit "music/squash1.ogg"
#define kMusicBroken "music/broken.ogg"

#define kMusicFirst "music/1.ogg"
#define kMusicSecond "music/2.ogg"
#define kMusicThird "music/3.ogg"
#define kMusicStart "music/start.ogg"

// plist cockroach die
#define kPListCockRoachDie "gianchet/gianchet0.plist"

//cockroach first in plist cockroach die
#define kImageCockRoachDieFirst "7.png"

// length of list
#define kNumberListDie 7

// plist cockroach
#define kPListCockRoach "gian0.plist"

//cockroach first in plist cockroach
#define kImageCockRoachFirst "gian1.png"

//time running
#define kTimeRunning 8

// life
#define kLife 3

// path save file
// on android
#define kPathAndroid "/data/data/softtech.apps.KillCockroachs/"

// on window
#define kPathWin32 "D:/"

// name file score
#define kFileTopScore "topscore"

// file 
#define kFileModeRead "r"
#define kFileModeWrite "w"

//gia tri mac dinh cua font size
//#define kFontSize 24

//gia tri mac dinh cua font name
#define kFontName "Arial"

//custom font
#define kFontNameCustom "fonts/freehani.ttf"

// pixel peer move
#define kDistancePeerMove 10 

// duration peer move
#define kMoveDura 0.5

#define kNumCockRoachMax 500

// load file anh
#define kPng ".png"
#define kJpg ".jpg"

// margin among cockroach
#define kMarginCockroach 10

//zOrder

// zOrder cockRoach
#define kZorderCockRoach 2
//Zoder cua cac doi tuong Impediment
#define kZoderImpediment 100

//zOrder background table
#define kZorderBackgroundTable 1

//zOrder label life
#define kZorderLabelLife 500

//zOrder label score
#define kZorderLabelScore 500

//zOrder bacground play again
#define kZorderBackground 1001

//zOrder label your score in gameover
#define kZorderYourScore 1002

//zOrder label best score in gameover
#define kZorderBestScore 1002

//zOrder button play again in gameover
#define kZorderButtonPlayAgain 1002

#define kZorderOverlay 4000

#define kZorderOverlayLabel 3001

//Tag value

#define kTagCockRoach 10000// overlay layer
#define kTagOverlay 2000

// overlay layer label
#define kTagOverlayLabel 2001

// label life
#define kTagLabelLife 2002

// label score
#define kTagLabelScore 2003

// background table
#define kTagBackgroundTable 2004

// defaul value of image lifes
#define kTagImageLife 5000



//ten vat can
#define kBowl 0
#define kCupOfCaffe 1
#define kBowlOfFruit 2
#define kBowlOfBread 3

// ten cac file anh cua vat can
#define kArmatureBowl "batvo/batvo0.png"
#define kArmatureBowlName "batvo"
#define kArmatureBowlPList "batvo/batvo0.plist"
#define kArmatureBowlJson "batvo/batvo.ExportJson"

#define kArmatureCupOfCaffe "cafedo/cafedo0.png"
#define kArmatureCupOfCaffeName "cafedo"
#define kArmatureCupOfCaffePlist "cafedo/cafedo0.plist"
#define kArmatureCupOfCaffeJson "cafedo/cafedo.ExportJson"

#define kArmatureBowlOfFrut "diatraicay/diatraicay0.png"
#define kArmatureBowlOfFrutName "diatraicay"
#define kArmatureBowlOfFrutPlist "diatraicay/diatraicay0.plist"
#define kArmatureBowlOfFrutJson "diatraicay/diatraicay.ExportJson"

#define kArmatureBowlOfBread "diabanhmivo/NewAnimation/NewAnimation0.png"
#define kArmatureBowlOfBreadName "NewAnimation"
#define kArmatureBowlOfBreadPlist "diabanhmivo/NewAnimation/NewAnimation0.plist"
#define kArmatureBowlOfBreadJson "diabanhmivo/NewAnimation/NewAnimation.ExportJson"
// define sound path
#define kSoundBroken "sfx_hit.ogg"

#define kImageButtonNormal "CloseNormal.png"

#define kImageButtonSelected "CloseSelected.png"

#define kImageBackground "HelloWorld.png"

#define kImageTable "table.jpg"

#define kImageCockRoach "congian.png"

//layer gameover
#define kImageBoard "gameover/bang.png"
#define kImageFlower "gameover/chauhoa.png"
#define kImageFaceboook "gameover/fb.png"
#define kImageTwitter "gameover/tw.png"
#define kImageTopScore "gameover/topscore.png"
#define kImageScore "gameover/score.png"
#define kImagePlayButton "gameover/play.png"

#define kImagePuffBlood "mau/13.png"


///Impediments and StunImpediments

//so frame anh luc vo nat
#define kNumberFrameBowl 4
#define kNumberFrameCupOfCaffe 4
#define kNumberFrameBowlOfFrut 4
#define kNumberFrameBowlOfBread 4

// trang thai do vo
#define kImpedimentBroken 1
#define kImpedimentNotBroken 0

// trang thai xuat hien
#define kImpedimentAppear 1
#define kImpedimentDisappear 0

// trang thai choang
#define kStunImpedimentStun 1
#define kStunImpedimentNotStun 0

// trang thai do vo va xuat hien
#define kImpedimentBrokenAndAppear 2
#define kImpedimentNotBrokenAndAppear -1
#define kImpedimentBrokenAndDisAppear 1
#define kImpedimentNotBrokenAndDisAppear 0

//thoi gian zero
#define kImpedimetZero 0

//thoi gian TimeBeforeAppear
#define kImpedimentTimeBeforeAppear 2

//thoi gian TimeAppear
#define kImpedimentTimeAppear 2

//thoi gian vat can bien mat tu tu
#define kImpedimentTimeDisappear 2

//thoi gian chop chop truoc khi xuat hien
#define kImpedimentsTimeAppear 2

//so lan chop chop truoc khi xuat hien
#define kImpedimentsNumber 10

//ma tran xuat hien vat can
#define kImpedimentArrayAppearWidth 4
#define kImpedimentArrayAppearHeight 4


// ti le scale cua logo trong panel GameOver
#define kScaleX 0.3
#define kScaleY 0.6


// save frame to cache
//#define SHARED_SPRITE_CACHE CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("flappy.plist")

// Cac trang thai cua player, co the bo sung them khi can thiet
enum CockRoachStatus {
    IDLE = 0,
    RUN,
	RUNNING,
	ESCAPE,
	DEATH
};

enum GameState {
	STARTGAME = 0,
    PLAY,
    FINISH
};

#endif

#ifndef __APPMACROS_H__
#define __APPMACROS_H__


#define DESIGN_RESOLUTION_320X480    0
#define DESIGN_RESOLUTION_768X1024   1
#define DESIGN_RESOLUTION_1536X2048  2

/* If you want to switch design resolution, change next line */
#define TARGET_DESIGN_RESOLUTION_SIZE  DESIGN_RESOLUTION_320X480

typedef struct tagResources
{
    cocos2d::CCSize size;
}Resources;

static Resources smallResource  =  { cocos2d::CCSizeMake(320, 480)};
static Resources mediumResource =  { cocos2d::CCSizeMake(768, 1024)};
static Resources largeResource  =  { cocos2d::CCSizeMake(1536, 2048)};

#if (TARGET_DESIGN_RESOLUTION_SIZE == DESIGN_RESOLUTION_320X480)
static cocos2d::CCSize designResolutionSize = cocos2d::CCSizeMake(320, 480);
#elif (TARGET_DESIGN_RESOLUTION_SIZE == DESIGN_RESOLUTION_768X1024)
static cocos2d::CCSize designResolutionSize = cocos2d::CCSizeMake(768, 1024);
#elif (TARGET_DESIGN_RESOLUTION_SIZE == DESIGN_RESOLUTION_1536X2048)
static cocos2d::CCSize designResolutionSize = cocos2d::CCSizeMake(1536, 2048 );
#else
#error unknown target design resolution!
#endif

// The font size 24 is designed for small resolution, so we should change it to fit for current design resolution
#define kFontSize  (cocos2d::CCEGLView::sharedOpenGLView()->getDesignResolutionSize().width / smallResource.size.width * 24)

#define CCPOINTARRAY_FOREACH(__array__, __object__)                                 \
    if ((__array__) && (__array__)->count() > 0)                                    \
    for(int __arr__ = 0;                                                            \
    (__arr__ <= __array__->count()) &&                                              \
    ((__object__ = __array__->getControlPointAtIndex(__arr__)).equals(__object__)); \
    __arr__++)

#endif